<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>修改密码</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/qdh.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/member.css" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/common/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidator.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidatorregex.js"></script>
<script type="text/javascript">
$(function(){
	$("#oldpassword").val("");
		$.formValidator.initConfig({formid:"form",autotip:true});
		$("#newpassword").formValidator({onshow:"请输入密码",onfocus:"密码应该为6-20位之间"}).inputValidator({min:6,max:20,onerror:"密码应该为6-20位之间"});
		$("#renewpassword").formValidator({onshow:"请输入确认密码",onfocus:"输入两次密码不同。",oncorrect:"密码输入一致"}).compareValidator({desid:"newpassword",operateor:"=",onerror:"输入两次密码不同。"});
	});	
function edit(){
		var oldpassword=$("#oldpassword").val();
		var newpassword=$("#newpassword").val();
		$.ajax({
			type: "post",
			url: "${pageContext.request.contextPath}/view/member/editPassword.action",
			dataType:'json',
			data:"newpwd="+newpassword+"&oldpwd="+oldpassword,
			success:function(data){
				if(data.success){
				alert("修改成功");
				top.window.location.href="${pageContext.request.contextPath}/view/member/index.action";
				}else{
				$("#msg").html("密码错误");
				}
			}
		});
		return false;
}
</script>
</head>
<body>
<div id="wrap">
	<s:include value="header.jsp"/>
	<div id="container">
		<div class="memberbox">
			<h1>修改密码</h1>
			<div class="fl loginbox">
				<div class="usercommonform">
					<form id="form" onsubmit="return edit();">
						<ul>
							<li><label><strong>原密码</strong><input type="password" class="minput1" id="oldpassword" name="oldpassword"/></label><span id="msg" style="margin-left:10px;color:red;font-size:13px;"></span></li>
							<li><label><strong>新密码</strong><input type="password" class="minput1" id="newpassword" name="newpassword"/></label></li>
							<li><label><strong>确认新密码</strong><input type="password"  class="minput1" id="renewpassword" name="renewpassword"/></label></li>
							<li><strong></strong><input type="submit" class="mbtn" id="edit	" value="确定" /></li>
						</ul>
					</form>
				</div>
			</div>
			<div class="fr reginfo">
				<h2>现在还不是网站会员？</h2>
				<p><a href="${pageContext.request.contextPath}/view/member/reg.jsp" title="注册新用户"><img src="${pageContext.request.contextPath}/common/image/regbtn.jpg" alt="注册新用户"/></a></p>
				
			</div>
		</div>
		<div class="clr"></div>
	</div>
    <div class="mt15"></div>
	<s:include value="../footer.htm"/>
</div>
</body>
</html>
